#pragma once

class Sample;
class WaveSample;
class VocoderView;
struct WaveComponent;

class CarrierStream
{
public:
	CarrierStream(void);
	~CarrierStream(void);

	void Initialize(int sampleRate, int chunkSize);
	Sample* GetData();
	Sample* GetData(int frequency, bool voiced);

	void(*userFunc1)(WaveSample*);
	void(*userFunc2)(WaveSample*);
	void(*userFunc3)(WaveSample*);
private:
	int sampleRate;
	int chunkSize;

	WaveComponent* triComponent;
	WaveComponent* squareComponent;
	WaveComponent* sawtoothComponent;
	WaveComponent* randomComponent;
	WaveComponent* func1Component;
	WaveComponent* func2Component;
	WaveComponent* func3Component;

	WaveComponent* sineComponent;
	WaveComponent* sineF2Component;
	WaveComponent* sineF3Component;
	WaveComponent* sineF4Component;
	WaveComponent* sineF5Component;
	WaveComponent* sineF6Component;
	WaveComponent* sineF7Component;

	void DeleteComponentSamples();
	void DeleteComponentSample(WaveComponent* component);
	void AddComponent(Sample* sample, WaveComponent* component);
	void UpdateComponent(WaveComponent* component, int frequency, int rate, double intensity);

};
